import request from "@/api/https.js"
export const shopApi = {
	//商品相关
	getCategoryList: (params = {}) => { //获取商品分类列表
		return request.request({
			url: "/goods/category",
			method: "GET",
			data: params
		})
	},
	getGoodsList: (params = {}) => { //获取商品列表
		return request.request({
			url: "/goods/items",
			method: "GET",
			data: params
		})
	},
	getGoodsDetails: (params = {}) => { //商品详情
		return request.request({
			url: `/goods/items/${params.item_id}`,
			// url: `/goods/newitems`,
			method: "GET",
			data: null
		})
	},
	addCart: (params = {}) => { //添加到购物车
		return request.request({
			url: "/cart",
			method: "post",
			data: params
		})
	},
	cartList: (params = {}) => { //获取购物车商品列表
		return request.request({
			url: "/cart",
			method: "get",
			data: params
		})
	},
	cartDel: (params = {}) => { //获取购物车商品列表
		return request.request({
			url: "/cartdel",
			method: "delete",
			data: params
		})
	},
	createOrder: (params) => { //生成订单
		return request.request({
			url: "/order",
			method: "post",
			data: params
		})
	},
	balancePay: (params = {}) => { //余额支付
		return request.request({
			url: "/user/balance",
			method: "post",
			data: params
		})
	},
	orderList: (params = {}) => { //获取订单列表
		return request.request({
			url: "/orders",
			method: "get",
			data: params
		})
	},
	orderDetail: (params = {}) => { //获取订单列表
		return request.request({
			url: `/order/${params.order_id}`,
			method: "get",
			data: ''
		})
	},
	balanceHistory: (params = {}) => { //获取订单列表
		return request.request({
			url: `/member/balance_record`,
			method: "get",
			data: params
		})
	},
}